﻿
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class JiaoShouJia : MonoBehaviour
{

    public event Action OnOver;

    private Animator ani;

    public AudioClip shoushangClip;
    public AudioClip luodigangguanClip;
    void Start()
    {

        ani = GetComponent<Animator>();
    }

    public void PlayAnimation()
    {
        ani.SetBool("isPlay", true);
    }

    /// <summary>
    /// 动画回掉
    /// </summary>
    public void PlayFallDownSound()
    {
        SoundManager.instance.PlaySoundEffect(shoushangClip);
        
        Invoke("PlayLuoDiSound", 1f);
    }

    void PlayLuoDiSound()
    {
        SoundManager.instance.PlaySoundEffect(luodigangguanClip);
        Invoke("GameOver", 3f);
    }
    void GameOver()
    {
        OnOver();
    }
}
